package org.budo.phone.api;

import java.util.Map;

import org.budo.support.lang.util.MapUtil;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * @author limingwei
 */
@Getter
@Setter
@Accessors(chain = true)
public class AbstractPhoneEvent implements BudoPhoneEvent {
    private Type type;

    private String callId;

    private String caller;

    private String destination;

    private Map<String, String> headers;

    @Override
    public String getHeader(String key) {
        return MapUtil.get(this.getHeaders(), key, null);
    }

    @Override
    public String toString() {
        return super.toString() + ", type=" + type + ", callId=" + callId + ", caller=" + caller + ", destination=" + destination;
    }
}